package com.oa.xinxi.dao;

import com.oa.xinxi.entity.PPE;
import org.apache.ibatis.jdbc.SQL;

public class PPESqlProvider {

    public String insertSelective(PPE record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("gdzc");
        
        if (record.getId() != null) {
            sql.VALUES("id", "#{id,jdbcType=INTEGER}");
        }
        
        if (record.getName() != null) {
            sql.VALUES("name", "#{name,jdbcType=VARCHAR}");
        }
        
        if (record.getModel() != null) {
            sql.VALUES("model", "#{model,jdbcType=VARCHAR}");
        }
        
        if (record.getNumber() != null) {
            sql.VALUES("number", "#{number,jdbcType=INTEGER}");
        }
        
        if (record.getPrice() != null) {
            sql.VALUES("price", "#{price,jdbcType=DOUBLE}");
        }
        
        if (record.getSumPrice() != null) {
            sql.VALUES("sum_price", "#{sumPrice,jdbcType=DOUBLE}");
        }
        
        if (record.getBuyTime() != null) {
            sql.VALUES("buy_time", "#{buyTime,jdbcType=DATE}");
        }
        
        if (record.getBaoxiu() != null) {
            sql.VALUES("baoxiu", "#{baoxiu,jdbcType=VARCHAR}");
        }
        
        if (record.getSyqk() != null) {
            sql.VALUES("syqk", "#{syqk,jdbcType=VARCHAR}");
        }
        
        if (record.getSyqkDetail() != null) {
            sql.VALUES("syqk_detail", "#{syqkDetail,jdbcType=VARCHAR}");
        }
        
        if (record.getAddress() != null) {
            sql.VALUES("address", "#{address,jdbcType=VARCHAR}");
        }
        
        if (record.getDepId() != null) {
            sql.VALUES("dep_id", "#{depId,jdbcType=INTEGER}");
        }
        
        if (record.getZerenren() != null) {
            sql.VALUES("zerenren", "#{zerenren,jdbcType=VARCHAR}");
        }
        
        if (record.getCreator() != null) {
            sql.VALUES("creator", "#{creator,jdbcType=VARCHAR}");
        }
        
        if (record.getCreatetime() != null) {
            sql.VALUES("createtime", "#{createtime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdator() != null) {
            sql.VALUES("updator", "#{updator,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdatetime() != null) {
            sql.VALUES("updatetime", "#{updatetime,jdbcType=TIMESTAMP}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(PPE record) {
        SQL sql = new SQL();
        sql.UPDATE("gdzc");
        
        if (record.getName() != null) {
            sql.SET("name = #{name,jdbcType=VARCHAR}");
        }
        
        if (record.getModel() != null) {
            sql.SET("model = #{model,jdbcType=VARCHAR}");
        }
        
        if (record.getNumber() != null) {
            sql.SET("number = #{number,jdbcType=INTEGER}");
        }
        
        if (record.getPrice() != null) {
            sql.SET("price = #{price,jdbcType=DOUBLE}");
        }
        
        if (record.getSumPrice() != null) {
            sql.SET("sum_price = #{sumPrice,jdbcType=DOUBLE}");
        }
        
        if (record.getBuyTime() != null) {
            sql.SET("buy_time = #{buyTime,jdbcType=DATE}");
        }
        
        if (record.getBaoxiu() != null) {
            sql.SET("baoxiu = #{baoxiu,jdbcType=VARCHAR}");
        }
        
        if (record.getSyqk() != null) {
            sql.SET("syqk = #{syqk,jdbcType=VARCHAR}");
        }
        
        if (record.getSyqkDetail() != null) {
            sql.SET("syqk_detail = #{syqkDetail,jdbcType=VARCHAR}");
        }
        
        if (record.getAddress() != null) {
            sql.SET("address = #{address,jdbcType=VARCHAR}");
        }
        
        if (record.getDepId() != null) {
            sql.SET("dep_id = #{depId,jdbcType=INTEGER}");
        }
        
        if (record.getZerenren() != null) {
            sql.SET("zerenren = #{zerenren,jdbcType=VARCHAR}");
        }
        
        if (record.getCreator() != null) {
            sql.SET("creator = #{creator,jdbcType=VARCHAR}");
        }
        
        if (record.getCreatetime() != null) {
            sql.SET("createtime = #{createtime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdator() != null) {
            sql.SET("updator = #{updator,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdatetime() != null) {
            sql.SET("updatetime = #{updatetime,jdbcType=TIMESTAMP}");
        }
        
        sql.WHERE("id = #{id,jdbcType=INTEGER}");
        
        return sql.toString();
    }
}